package com.lzw.breezeNovel.WebAdmin.controller;


import com.lzw.breezeNovel.WebAdmin.service.FileUploadService;
import com.lzw.breezeNovel.common.result.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RequestMapping("/admin")
@RestController
@SuppressWarnings("all")
public class FileUploadController {

		/**
		 * 文件上传服务
		 */
		@Resource
		private FileUploadService fileUploadService;
		/**
		*上传图片
		*/
		@PostMapping("/upload")
		public Result<String> upload(@RequestParam MultipartFile file) throws Exception {
		// 上传文件
		String url = fileUploadService.upload(file);
		return Result.ok(url);
	}
}
